package memento;

/**
 * @Author shenhan
 * @Date: 2020/4/10 23:16
 * @Description:
 */
public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator();
        CareTaker careTaker = new CareTaker();
        originator.setState("状态1");
        careTaker.add(originator.saveStateMemnto());
        originator.setState("状态2");
        careTaker.add(originator.saveStateMemnto());
        originator.setState("状态3");
        careTaker.add(originator.saveStateMemnto());

        System.out.println("当前是"+originator.getState());
        originator.getStateFromMemento(careTaker.get(0));
        System.out.println("当前是"+originator.getState());
    }
}
